﻿using System;
using System.Collections.Generic;
using System.Text;


namespace DaInterFace.SYN
{
    public interface ISYN
    {
        event SYNMessageHandler MessageEvent;

        IDataBase Data { get; }

        ISYNSerial Serial { get; }

        IConfig Config { get; }

        //Dictionary<String, Dictionary<String, Dictionary<String, BaseInfo>>> BaseDictionary { get; }
        void Message(MessageType type, String note);
        void Message(MessageType type, String note, Double span);
    }

    public class BaseInfo
    {
        public BaseInfo(String id)
        {
            ID = id;
        }
        public String ID;
    }

    public class CodeResult
    {
        public String Code;
        public EnumResult Result;
        public String Message;
        public String Content;
        public String recordID;
    }

    public interface ISYNSerial
    {
        String Serializer(SerialType st, Type type, object obj);

        object Deserialize(SerialType st, Type type, string strObj);
    }

    public interface ISYNChildSet
    {
        void Code(ISYN handler, CodeResult result, SYNRight user,SerialType st, String parameter);
    }
    
    public interface ISYNChildGet
    {
        void Code(ISYN handler, ref CodeResult result, SYNRight user, SerialType st, String baseNo, String billId);
    }

    public class SYNRight
    {
        public String Name;
        public SerialType SerialStyle = SerialType.Json;
        public Boolean A01;
        public Boolean A02;
        public Boolean A03;
        public Boolean A04;
        public Boolean A05;
        public Boolean A06;
        public Boolean A07;
        public Boolean A08;
        public Boolean A09;
        public Boolean A10;
    }

    public class SYNParameter
    {
        public String CodeName;
        public String User;
        public String Parameters;
    }

    public enum EnumResult : int
    {
        Update = 0,
        Insert = 1,
        None = 2
    }



    public delegate void SYNMessageHandler(MessageType type, String note, Double span);
}
